<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>Thread Support in Qt</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><p class="naviNextPrevious headerNavi"><a class="nextPage" href="threads-starting.html">Starting Threads with QThread</a></p>
<div class="toc">
<h3><a id="toc" name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#topics">Topics:</a></li>
<li class="level1"><a href="#recommended-reading">Recommended
Reading</a></li>
<li class="level1"><a href="#the-threading-classes">The Threading
Classes</a></li>
</ul>
</div>
<h1 class="title">Thread Support in Qt</h1>

<div class="descr"><a id="details" name="details" />
<p>Qt provides thread support in the form of platform-independent
threading classes, a thread-safe way of posting events, and
signal-slot connections across threads. This makes it easy to
develop portable multithreaded Qt applications and take advantage
of multiprocessor machines. Multithreaded programming is also a
useful paradigm for performing time-consuming operations without
freezing the user interface of an application.</p>
<p>Earlier versions of Qt offered an option to build the library
without thread support. Since Qt 4.0, threads are always
enabled.</p>
<a id="topics" name="topics" />
<h2>Topics:</h2>
<ul>
<li><a href="#recommended-reading">Recommended Reading</a></li>
<li><a href="#the-threading-classes">The Threading Classes</a></li>
<li><a href="threads-starting.html">Starting Threads with
QThread</a></li>
<li><a href="threads-synchronizing.html">Synchronizing
Threads</a></li>
<li><a href="threads-reentrancy.html">Reentrancy and
Thread-Safety</a></li>
<li><a href="threads-qobject.html">Threads and QObjects</a></li>
<li><a href="threads-qtconcurrent.html">Concurrent
Programming</a></li>
<li><a href="threads-modules.html">Thread-Support in Qt
Modules</a></li>
</ul>
<a id="recommended-reading" name="recommended-reading" />
<h2>Recommended Reading</h2>
<p>This document is intended for an audience that has knowledge of,
and experience with, multithreaded applications. If you are new to
threading see our Recommended Reading list:</p>
<ul>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/0134436989/trolltech/t">Threads
Primer: A Guide to Multithreaded Programming</a></li>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/0131900676/trolltech/t">Thread
Time: The Multithreaded Programming Guide</a></li>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/1565921151/trolltech/t">Pthreads
Programming: A POSIX Standard for Better Multiprocessing</a></li>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/1565922964/trolltech/t">Win32
Multithreaded Programming</a></li>
</ul>
<a id="the-threading-classes" name="the-threading-classes" />
<h2>The Threading Classes</h2>
<p>These classes are relevant to threaded applications.</p>
<table class="annotated">
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qtconcurrentrun.html">Asynchronous Run</a></p>
</td>
<td class="tblDescr">
<p>The &lt;QtConcurrentRun&gt; header provides a way to run a
function in a separate thread.</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qtconcurrentfilter.html">Concurrent Filter and
Filter-Reduce</a></p>
</td>
<td class="tblDescr">
<p>The &lt;QtConcurrentFilter&gt; header provides concurrent Filter
and Filter-Reduce.</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qtconcurrentmap.html">Concurrent Map and
Map-Reduce</a></p>
</td>
<td class="tblDescr">
<p>The &lt;QtConcurrentMap&gt; header provides concurrent Map and
MapReduce.</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qatomicint.html">QAtomicInt</a></p>
</td>
<td class="tblDescr">
<p>Platform-independent atomic operations on integers</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qatomicpointer.html">QAtomicPointer</a></p>
</td>
<td class="tblDescr">
<p>Template class that provides platform-independent atomic
operations on pointers</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qfuture.html">QFuture</a></p>
</td>
<td class="tblDescr">
<p>Represents the result of an asynchronous computation</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qfuturesynchronizer.html">QFutureSynchronizer</a></p>
</td>
<td class="tblDescr">
<p>Convenience class that simplifies QFuture synchronization</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qfuturewatcher.html">QFutureWatcher</a></p>
</td>
<td class="tblDescr">
<p>Allows monitoring a QFuture using signals and slots</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qmutex.html">QMutex</a></p>
</td>
<td class="tblDescr">
<p>Access serialization between threads</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qmutexlocker.html">QMutexLocker</a></p>
</td>
<td class="tblDescr">
<p>Convenience class that simplifies locking and unlocking
mutexes</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qreadlocker.html">QReadLocker</a></p>
</td>
<td class="tblDescr">
<p>Convenience class that simplifies locking and unlocking
read-write locks for read access</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qreadwritelock.html">QReadWriteLock</a></p>
</td>
<td class="tblDescr">
<p>Read-write locking</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qrunnable.html">QRunnable</a></p>
</td>
<td class="tblDescr">
<p>The base class for all runnable objects</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qsemaphore.html">QSemaphore</a></p>
</td>
<td class="tblDescr">
<p>General counting semaphore</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qthread.html">QThread</a></p>
</td>
<td class="tblDescr">
<p>Platform-independent threads</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qthreadpool.html">QThreadPool</a></p>
</td>
<td class="tblDescr">
<p>Manages a collection of QThreads</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qthreadstorage.html">QThreadStorage</a></p>
</td>
<td class="tblDescr">
<p>Per-thread data storage</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qwaitcondition.html">QWaitCondition</a></p>
</td>
<td class="tblDescr">
<p>Condition variable for synchronizing threads</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qwritelocker.html">QWriteLocker</a></p>
</td>
<td class="tblDescr">
<p>Convenience class that simplifies locking and unlocking
read-write locks for write access</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qtconcurrent.html">QtConcurrent</a></p>
</td>
<td class="tblDescr">
<p>High-level APIs that make it possible to write multi-threaded
programs without using low-level threading primitives</p>
</td>
</tr>
</table>
<p><b>Note:</b> Qt's threading classes are implemented with native
threading APIs; e.g., Win32 and pthreads. Therefore, they can be
used with threads of the same native API.</p>
</div>

<p class="naviNextPrevious footerNavi"><a class="nextPage" href="threads-starting.html">Starting Threads with QThread</a></p>
<div class="ft" />
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>